/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;


import java.sql.Connection;
import java.util.Vector;
import java.sql.*;

/**
 *
 * @author user
 */
public class Addministave
{
    private int accountid;
    private String accountname;
    private String username;
    private String password;
    private String address;
    private String email;
    private String phone;
    private String authority;

    /**
     * @return the accountid
     */
    public int getAccountid() {
        return accountid;
    }

    /**
     * @param accountid the accountid to set
     */
    public void setAccountid(int accountid) {
        this.accountid = accountid;
    }

    /**
     * @return the accountname
     */
    public String getAccountname() {
        return accountname;
    }

    /**
     * @param accountname the accountname to set
     */
    public void setAccountname(String accountname) {
        this.accountname = accountname;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the address
     */
    public String getAddress() {
        return address;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the phone
     */
    public String getPhone() {
        return phone;
    }

    /**
     * @param phone the phone to set
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * @return the authority
     */
    public String getAuthority() {
        return authority;
    }

    /**
     * @param authority the authority to set
     */
    public void setAuthority(String authority) {
        this.authority = authority;
    }
    public Vector<Addministave> Addlist()
    {
        Vector<Addministave> adlist=new Vector<Addministave>();
        try
        {
            Connection con=ConecttoDatabase.getConnection();
            String query="select * from Administrative";
            Statement st=con.createStatement();
            ResultSet rs=st.executeQuery(query);
            while(rs.next())
            {
                Addministave ad=new Addministave();
                ad.setAccountid(rs.getInt("AccountId"));
                ad.setUsername(rs.getString("UserName"));
                ad.setPassword(rs.getString("PassWord"));
                ad.setAccountname(rs.getString("AccountName"));
                ad.setAddress(rs.getString("Address"));
                ad.setEmail(rs.getString("Email"));
                ad.setPhone(rs.getString("Phone"));
                ad.setAuthority(rs.getString("Authority"));
                adlist.add(ad);
            }
        }
        catch(Exception ex)
        {
            System.out.println(ex);
            adlist=null;
        }
        return adlist;
    }
    
}
